<!--考勤配卡-->
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="my"  uri="http://www.trkj.com/tr1702/tags"%>
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.min.js"  />"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/default/easyui.css"/>" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="/js/jquery-easyui-1.5.5.6/themes/icon.css"/>">
<title>考勤配卡</title>
</head>
<body>
	<script type="text/javascript">
		$(function() {
			$('#dgcard_with').datagrid({
				rownumbers : true,
				autoRowHeight : true,
				fitColumns : true,
				striped : true,
				rownumbers : true,
				fit:true

			});
			

		});
		$("#add_card_whith").linkbutton({
			onClick:function(){
				$('#p_with_card').panel({    
				    href:'to_add_timecard_with',    
				    onLoad:function(){    
				           
				    }    
				}); 
			}
		});
		//刷新
		$("#timecar_whith_reload").linkbutton({
			onClick:function(){
				$("#dgcard_with").datagrid("reload");
			}
		});
		//搜索
		$("#timecard_id_sousuo").linkbutton({
			onClick:function(){
				var seeText = $("#timecard_id").textbox("getText");
				$("#dgcard_with").datagrid({url:'to_is_all_findTimecardwhithBytimecardId?timecardId='+seeText,method:'get'});
				$("#dgcard_with").datagrid("reload");
			}
		});
		//删除
		/* $("#timecar_whith_del").linkbutton({
			onClick:function(){
			
				var r=$("#dgcard_with").datagrid("getSelected");
			
				if(r!=undefined){
					$("#dgcard_with").datagrid({url:'del_timecardByid?attcardId='+r.ATTCARD_ID+"&timecardId="+r.TIMECARD_ID,method:'get'});
					$("#dgcard_with").datagrid("reload");
				}else{
					$.messager.alert('提示','请选择一行');    
				}
				
			}
		}); */
		
		
		 $("#timecar_whith_del").linkbutton({onClick:function(){
			 var dgd= $("#dgcard_with").datagrid("getSelected");
			if(!dgd){
					$.messager.alert('提示', '没有选中要删除的行！');
					return;
			}
			$.messager.confirm('确认', '真的要删除吗？', function(v){
				if(v){
					$("<form method = 'post'>").appendTo(document.body).form({
						url:'del_timecardByid',
						onSubmit:function(params){
							params["attcardId"] =dgd.ATTCARD_ID;
							params["timecardId"] =dgd.TIMECARD_ID;
						},success:function(v){
							v = eval("(" + v + ")");
							if(v.success){
								$.messager.alert('恭喜', '删除成功');
								$('#dgcard_with').datagrid('reload');
							}else{
								$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
							}
						}
					}).submit();
				}else{
					
				}
				
				
			}); 
		}});

	</script>
	<div id="p_with_card" class="easyui-panel" 
        data-options="fit:true">
	<table id="dgcard_with" toolbar="#tbcwithard" class="easyui-datagrid"
	data-options="
				fitColumns:true,
				fit:true,
				pagination:true,     
				pageSize:10,    
				pageList: [10,20,30,40,50], 
				url:'is_to_findAllAttendancecard',
				rownumbers:true,
				Striped:true, 
				singleSelect:true,
				striped:true
        ">
		<thead>
			<tr>
				<th width="40" align="center" data-options="field:'ATTCARD_ID'">编号</th>
				<th width="50" align="center" data-options="field:'STAIN_ID'">员工编号</th>
				<th width="60" align="center" data-options="field:'STAIN_NAME'">员工名称</th>
				<th width="60" align="center" data-options="field:'TIMECARD_ID'">考勤卡</th>
				<th width="120" align="center" data-options="field:'ATTCARD_EFFECT',formatter:function(value,row,index){
					if(value!=null){
						var date = new Date(value);
						return date.toLocaleString();
					}
						return;
				}">生效日期</th>
				<th width="120" align="center" data-options="field:'ATTCARD_LOSEEFF',formatter:function(value,row,index){
					if(value!=null){
						var date = new Date(value);
						return date.toLocaleString();
					}
						return;
				}">失效日期</th>
				<th width="90" align="center" data-options="field:'ATTCARD_REASON'">原因</th>
				<th width="90" align="center" data-options="field:'ATTCARD_REMARKS'">备注</th>
				<th width="50" align="center" data-options="field:'ATTCARD_PERSON'">创建者</th>
				<th width="120" align="center" data-options="field:'ATTCARD_STARTDATE',formatter:function(value,row,index){
					if(value!=null){
						var date = new Date(value);
						return date.toLocaleString();
					}
						return;
				}">创建时间</th>
			</tr>
		</thead>
		<tbody>
			
		</tbody>


	</table>
	<div id="tbcwithard">
		<my:g id="33"><a href="#" class="easyui-linkbutton"
			data-options="iconCls:'icon-add'" id="add_card_whith">新增</a></my:g>
			<span class="xtb-sep"></span>
		<a href="#" class="easyui-linkbutton"
			data-options="iconCls:'icon-reload'" id="timecar_whith_reload">刷新</a>
			<my:g id="34"><a href="#" class="easyui-linkbutton"
			data-options="iconCls:'icon-no'" id="timecar_whith_del">删除</a></my:g>
			<span class="xtb-sep"></span>
			 <input
			class="easyui-textbox" data-options="prompt:'考勤卡'"
			style="width: 150px" id="timecard_id"> <a class="easyui-linkbutton"
			data-options="iconCls:'icon-search'" id="timecard_id_sousuo">搜素</a>
	</div>

</div> 
</body>
</html>